package com.ball.dev.controller;



import com.ball.common.dtos.ResponseResult;
import com.ball.dev.entity.dto.LoginDto;
import com.ball.dev.service.IAppUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.net.MalformedURLException;

/**
 * 用户
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author lou
 * @since 2023-11-25
 */
@RestController
@RequestMapping("/appUser")
@RequiredArgsConstructor
public class AppUserController {

    private  final IAppUserService appUserService;


    @GetMapping
    public void getUserInfo(){
        System.out.println("getUserInfo");
    }
    @PostMapping("/login")
    public ResponseResult loginUser(@RequestBody LoginDto dto){

        return appUserService.loginUser(dto);
    }

    @PostMapping("/register")
    public ResponseResult UserRegister(@RequestBody LoginDto dto){
        return appUserService.UserRegister(dto);
    }


    @PostMapping("/WXLogin")
    public ResponseResult WXLogin( @RequestParam("code") String code) throws MalformedURLException {
        return appUserService.WXLogin(code);
    }



}
